<?php $this->Html->addCrumb('Trang chủ','/')?>
<div class="adsHome">
	<div class="adsHome1">
		<a href="/bo-suu-tap"><img alt="" height="266" src="/img/home-pic-4.jpg" width="284" /></a>
	</div>
	<div class="adsHome2">
		<a href="/ao-nguc"><img alt="" height="266" src="/img/home-pic-2.jpg" style="padding-bottom: 5px;" width="284" /></a>
	</div>
	<div class="adsHome3">
		<a href="/quan-lot"><img alt="" height="266" src="/img/home-pic-1.jpg" width="284" /></a>
	</div>
</div>

<?php echo $this->element('left_menu',array('categories'=>$categories,'brand' => null))?>

<div class="mainColumn">
	<?php if($newest):?>
	<div class="productList">
		<h3>Sản phẩm mới nhất</h3>
		<?php
		$i = 0;
		foreach($newest as $key=>$item):
		$i++;
		?>
		<div class="productListItem<?php if($i % 4 == 0) echo ' productListItemEnd'?>">
			<?php
			$url = '/san-pham/'.$item['Product']['slug'];
			$image_path = '/upload_files/'.$item['Product']['photo_dir'].'/'.$item['Product']['photo'];			
			if(!file_exists(WWW_ROOT.$image_path)){
				$image_path = 'no_image.jpg';
			}
			echo $this->Html->image($image_path,array('alt'=>$item['Product']['name'],'title'=>$item['Product']['name'],'url'=>$url,'width'=>140));
			?>
			<div><strong><?php echo $item['Product']['name']?></strong></div>
			<strong>Mã SP:</strong> <?php echo $item['Product']['product_code']?><br>
			<strong>Giá:</strong> <span class="productListItemPrice"><?php echo number_format($item['Product']['price'])?> VND</span>
		</div>
		<?php endforeach;?>				
	</div>
	<?php endif;?>
	
	<?php if($bestseller):?>
	<div class="productList">
		<h3>Sản phẩm bán chạy nhất</h3>
		<?php		
		$i = 0;
		foreach($bestseller as $key=>$item):
		$i++;
		?>
		<div class="productListItem<?php if($i % 4 == 0) echo ' productListItemEnd'?>">
			<?php
			$url = '/san-pham/'.$item['Product']['slug'];
			$image_path = '/upload_files/'.$item['Product']['photo_dir'].'/'.$item['Product']['photo'];			
			if(!file_exists(WWW_ROOT.$image_path)){
				$image_path = 'no_image.jpg';
			}
			echo $this->Html->image($image_path,array('alt'=>$item['Product']['name'],'title'=>$item['Product']['name'],'url'=>$url,'width'=>140));
			?>
			<div><strong><?php echo $item['Product']['name']?></strong></div>
			<strong>Mã SP:</strong> <?php echo $item['Product']['product_code']?><br>
			<strong>Giá:</strong> <span class="productListItemPrice"><?php echo number_format($item['Product']['price'])?> VND</span>
		</div>
		<?php endforeach;?>				
	</div>
	<?php endif;?>
</div>